]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
ci: Use built-in option parsing in meson-install
authorFlorian Müllner <fmuellner@gnome.org>
Mon, 20 Mar 2023 00:41:15 +0000 (01:41 +0100)
committerMarge Bot <marge-bot@gnome.org>
Thu, 20 Apr 2023 15:59:56 +0000 (15:59 +0000)
This is less concise than the current ad-hoc parsing, but gets
us error handling ("unknown option --foo") and is easier to
extend.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2712>

.gitlab-ci/install-meson-project.sh

index fbb62b9d05db16289b6bc3ad33bf61cd3e679a35..c49d50c7fa2ca695ecd8b6b8e5b3dd6c1e16f1ba 100755 (executable)
@@ -14,11 +14,28 @@ usage() {
        EOF
 }
 
+TEMP=$(getopt \
+  --name=$(basename $0) \
+  --options=D \
+  -- "$@")
+
+eval set -- "$TEMP"
+unset TEMP
+
 MESON_OPTIONS=()
 
-while [[ $1 =~ ^-D ]]; do
-  MESON_OPTIONS+=( "$1" )
-  shift
+while true; do
+  case "$1" in
+    -D)
+      MESON_OPTIONS+=( -D$2 )
+      shift 2
+    ;;
+
+    --)
+      shift
+      break
+    ;;
+  esac
 done
 
 if [[ $# -lt 4 ]]; then